package com.cloud.school.bus.teacherhelper.modules.settings;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.cloud.school.bus.teacherhelper.R;
import com.cloud.school.bus.teacherhelper.base.activity.BaseWebViewActivity;
import com.cloud.school.bus.teacherhelper.base.view.TitleNavBarView;
/**
 * 软件许可及服务协议
 * @author lenovo
 *
 */
public class PermitProtocolActivity extends BaseWebViewActivity {

	private String mUrlString;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_webview);
		
		init();
	}
	
	@Override
	protected void init() {
		
		mUrlString = getIntent().getStringExtra("url");
		
		mWebView = (WebView)findViewById(R.id.webView);
		initWebView(mWebView);
		mWebView.loadUrl(mUrlString);
		
		setTitleNavBar();
		
		setListener();
	}
	
	@Override
	protected void setListener() {
		
		mWebView.setWebViewClient(new WebViewClient(){
			@Override
			public boolean shouldOverrideUrlLoading(WebView view, String url) {
				mWebView.loadUrl(url);
				return true;
			}
		});
		
	}
	
	protected void setTitleNavBar() {
		final TitleNavBarView titleNavBarView = (TitleNavBarView) findViewById(R.id.titleNavBarView);
		titleNavBarView.setMessage(getString(R.string.terms_and_privacy));
		titleNavBarView.setLeftButtonOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				cancel();
			}
		});
		titleNavBarView.setRightButtonVisibility(View.INVISIBLE);
	}
	
}
